//
//  ERCustomAlertView.h
//  EnjoyRunning
//
//  Created by ljm on 2017/4/24.
//  Copyright © 2017年 ljm. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger , CustomAlertActionStyle)
{
    CustomAlertActionStyleDefault = 0 ,
    CustomAlertActionStyleDestructive,      //确定
    CustomAlertActionStyleCancel            //取消
};

@interface ERCustomAlertAction : NSObject<NSCopying>

@property (nullable,strong,readonly) NSString *title;
@property (nonatomic,readonly) CustomAlertActionStyle style;
@property (nonatomic,assign,getter=isenable) BOOL enabled;

+ (instancetype) actionWithTitle:(nullable NSString *)title style:(CustomAlertActionStyle)style handler:(void (^ __nullable) (ERCustomAlertAction *action))handler;

@end


@interface ERCustomAlertView : UIView

@property (nonatomic, weak, readonly) UILabel *titleLable;
@property (nonatomic, weak, readonly) UILabel *messageLabel;

// alertView textfield array
@property (nonatomic, strong, readonly) NSArray *textFieldArray;

// default is 280
@property (nonatomic, assign) CGFloat alertViewWidth;

// contentView space custom
@property (nonatomic, assign) CGFloat contentViewSpace;

// textLabel custom
@property (nonatomic, assign) CGFloat textLabelSpace;
@property (nonatomic, assign) CGFloat textLabelContentViewEdge;

// button custom
@property (nonatomic, assign) CGFloat buttonHeight;
@property (nonatomic, assign) CGFloat buttonSpace;
@property (nonatomic, assign) CGFloat buttonContentViewEdge;
@property (nonatomic, assign) CGFloat buttonContentViewTop;
@property (nonatomic, assign) CGFloat buttonCornerRadius;
@property (nonatomic, strong) UIFont *buttonFont;
@property (nonatomic, strong) UIColor *buttonDefaultBgColor;
@property (nonatomic, strong) UIColor *buttonCancelBgColor;
@property (nonatomic, strong) UIColor *buttonDestructiveBgColor;

// textField custom
@property (nonatomic, strong) UIColor *textFieldBorderColor;
@property (nonatomic, strong) UIColor *textFieldBackgroudColor;
@property (nonatomic, strong) UIFont *textFieldFont;
@property (nonatomic, assign) CGFloat textFieldHeight;
@property (nonatomic, assign) CGFloat textFieldEdge;
@property (nonatomic, assign) CGFloat textFieldBorderWidth;
@property (nonatomic, assign) CGFloat textFieldContentViewEdge;

+ (instancetype)actionViewWithTitle:(NSString *)title message:(NSString *)message;

- (void) addAction:(ERCustomAlertAction *)action;

- (void)addTextFieldWithConfigurationHandler:(void (^)(UITextField *textField))configurationHandler;

@end

NS_ASSUME_NONNULL_END
